import { useState } from "react"
/**
 * 
 * @param {Number} initial 一个初始值
 * @returns 
 */
const Hook = (initial) => {
    let [count, setCount] = useState(initial)
    const add = () => {
        setCount([++count])
    }
    const divide = () => {
        setCount([count / 2])
    }
    const muilt = () => {
        setCount([count * 2])
    }
    const minus = () => {
        setCount([--count])
    }
   return ([count,{
       add,
       divide,
       muilt,
       minus
   }])
}
export default Hook